﻿namespace Innovative.ProXr
{
	/// <summary>
	/// 
	/// </summary>
	public class DwordResponseConverter : IResponseConverter<int>
	{
		int IResponseConverter<int>.Convert(RelayByte[] response)
		{
			int returnValue = 0;

			if (response.Length == 2)
			{
				returnValue = (int)(response[1] + (256 * response[0]));
			}
			else
			{
				throw new InvalidResponseException("The DwordResponseConverter converter expects a two byte response.");
			}

			return returnValue;
		}
	}
}
